package com.leyou.gateway.fallback;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/hystrix")
public class FallbackController {

    /**
     * 默认超时处理
     */
    @RequestMapping(value = "/fallback")
    public ResponseEntity<Map<String,Object>> fallBackController(){

        Map<String, Object> map = new HashMap<>();
        map.put("code","504");
        map.put("msg","请求超时");
        return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body(map);
    }
}
